<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>取得 getimagesize、exif_read_data、exif_thumbnail、exif_imagetype 所返回的图像类型的 MIME 类型</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.image-type-to-extension.html">« image_type_to_extension</a></li>
      <li style="float: right;"><a href="function.image2wbmp.html">image2wbmp »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.image.html">GD 和图像处理 函数</a></li>
    <li>取得 getimagesize、exif_read_data、exif_thumbnail、exif_imagetype 所返回的图像类型的 MIME 类型</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.image-type-to-mime-type" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">image_type_to_mime_type</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">image_type_to_mime_type</span> &mdash; <span class="dc-title">取得 getimagesize、exif_read_data、exif_thumbnail、exif_imagetype 所返回的图像类型的 MIME 类型</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.image-type-to-mime-type-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>image_type_to_mime_type</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$image_type</code></span>): <span class="type">string</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>image_type_to_mime_type()</strong></span> 函数将确定 IMAGETYPE 常量的 MIME 类型。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.image-type-to-mime-type-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">image_type</code></dt>

     <dd>

      <p class="para">
       <code class="literal">IMAGETYPE_XXX</code> 常量之一。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.image-type-to-mime-type-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回值如下：
   <table class="doctable table">
    <caption><strong>返回值常量</strong></caption>
    
     <thead>
      <tr>
       <th><code class="parameter">image_type</code></th>
       <th>返回值</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><strong><code>IMAGETYPE_GIF</code></strong></td>
       <td><code class="literal">image/gif</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_JPEG</code></strong></td>
       <td><code class="literal">image/jpeg</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_PNG</code></strong></td>
       <td><code class="literal">image/png</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_SWF</code></strong></td>
       <td><code class="literal">application/x-shockwave-flash</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_PSD</code></strong></td>
       <td><code class="literal">image/psd</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_BMP</code></strong></td>
       <td><code class="literal">image/bmp</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_TIFF_II</code></strong>（小端字节顺序）</td>
       <td><code class="literal">image/tiff</code></td>
      </tr>

      <tr>
       <td>
        <strong><code>IMAGETYPE_TIFF_MM</code></strong>（大端字节顺序）
       </td>
       <td><code class="literal">image/tiff</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_JPC</code></strong></td>
       <td><code class="literal">application/octet-stream</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_JP2</code></strong></td>
       <td><code class="literal">image/jp2</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_JPX</code></strong></td>
       <td><code class="literal">application/octet-stream</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_JB2</code></strong></td>
       <td><code class="literal">application/octet-stream</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_SWC</code></strong></td>
       <td><code class="literal">application/x-shockwave-flash</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_IFF</code></strong></td>
       <td><code class="literal">image/iff</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_WBMP</code></strong></td>
       <td><code class="literal">image/vnd.wap.wbmp</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_XBM</code></strong></td>
       <td><code class="literal">image/xbm</code></td>
      </tr>

      <tr>
       <td><strong><code>IMAGETYPE_ICO</code></strong></td>
       <td><code class="literal">image/vnd.microsoft.icon</code></td>
      </tr>

       <tr>
       <td><strong><code>IMAGETYPE_WEBP</code></strong></td>
       <td><code class="literal">image/webp</code></td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.image-type-to-mime-type-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2622">
    <p><strong>示例 #1 <span class="function"><strong>image_type_to_mime_type()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-type:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">image_type_to_mime_type</span><span style="color: #007700">(</span><span style="color: #0000BB">IMAGETYPE_PNG</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.image-type-to-mime-type-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: <p class="para">此函数不需要 GD 图象库。</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.image-type-to-mime-type-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.getimagesize.html" class="function" rel="rdfs-seeAlso">getimagesize()</a> - 取得图像大小</span></li>
   <li class="member"><span class="function"><a href="function.exif-imagetype.html" class="function" rel="rdfs-seeAlso">exif_imagetype()</a> - 判断一个图像的类型</span></li>
   <li class="member"><span class="function"><a href="function.exif-read-data.html" class="function" rel="rdfs-seeAlso">exif_read_data()</a> - 从一个图片文件中读取 EXIF 头信息</span></li>
   <li class="member"><span class="function"><a href="function.exif-thumbnail.html" class="function" rel="rdfs-seeAlso">exif_thumbnail()</a> - 检索图像的嵌入式缩略图</span></li>
  </ul>
 </div>

</div></div></div></body></html>